package com.superhelper.common.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.superhelper.common.domain.AuserDeliver;
import com.superhelper.common.domain.AuserShop;

/**
 * 
 * @author Administrator
 *
 */

public interface DeliverMapper {

    @Insert("replace into auser_deliver_conf(auserId,normal_sec,interval_sec,gt_money,delay_sec,fixed_minute,part_money,gt_minute,max_money,prev_minute,state)values"
            + "(#{a.auserId},#{a.normal_sec},#{a.interval_sec},#{a.gt_money},#{a.delay_sec},#{a.fixed_minute},#{a.part_money},#{a.gt_minute},#{a.max_money},#{a.prev_minute},#{a.state})")
    int addAuserDeviler(@Param("a") AuserDeliver entity);

    @Select("select * from auser_deliver_conf where auserId=#{auserId} ")
    AuserDeliver getAuserDeliver(@Param("auserId") Integer auserId);

    @Select("select a.* from auser_deliver_conf a, auser_shop b where b.shopId=#{shopId} and b.shop_type=#{type} and a.auserId=b.auserId and a.state=1")
    AuserDeliver getAuserDeliverByShopIdAndShopType(@Param("shopId") String shopId, @Param("type") String type);

    @Select("select * from auser_shop")
    List<AuserShop> getAllUserShop();

    @Select("select * from auser_shop where id =#{value}")
    AuserShop getUserShop(Long id);
}
